import {createApp} from 'vue'
import App from '@/App.vue'
import router from '@/router/index'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import ECharts from "vue-echarts";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// import {use} from 'echarts/core.js'
import 'echarts'//全局引入
import {createPinia} from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import '@/router/permission'
import {globalErrorHandler,warnHandler} from "@/util/handler/error"
import {getImageBaseUrl,getUpFileUrl} from '@/util/projectData'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app = createApp(App)
app.use(ElementPlus)
app.use(router)
app.use(pinia)
app.config.errorHandler = globalErrorHandler;//全局异常处理
app.config.warnHandler = warnHandler;//全局异步操作异常处理
app.config.globalProperties.$imgBaseUrl = getImageBaseUrl
app.config.globalProperties.$upFile = getUpFileUrl
app.component('e-charts',ECharts)
// 屏蔽错误信息
app.config.errorHandler = () => null;
// 屏蔽警告信息
app.config.warnHandler = () => null;
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.mount('#app')

